package com.imooc.controller;

import com.imooc.pojo.IMoocJSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2018\5\22 0022.
 */
@RestController
@RequestMapping("redis")
public class RedisController {
    @Autowired
    private StringRedisTemplate strRedis;

    @RequestMapping("/test")
    public IMoocJSONResult test() {

        strRedis.opsForValue().set("imooc-cache", "hello 慕课网~~~~~~");

        return IMoocJSONResult.ok(strRedis.opsForValue().get("imooc-cache"));
    }

}
